home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.UserDocument axdUserDoc
- ClientHeight = 225
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 705
- HScrollSmallChange= 225
- ScaleHeight = 225
- ScaleWidth = 705
- VScrollSmallChange= 225
- Begin MSComctlLib.Toolbar Toolbar1
- Align = 1 'Align Top
- Height = 330
- Left = 0
- TabIndex = 1
- Top = 0
- Width = 705
- _ExtentX = 1244
- _ExtentY = 582
- ButtonWidth = 609
- ButtonHeight = 582
- ToolTips = 0 'False
- AllowCustomize = 0 'False
- Wrappable = 0 'False
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 2
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "EquaFlipButton"
- Object.ToolTipText = "Flip variables around an equal sign"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "WiperButton"
- Object.ToolTipText = "Clear the Immediate Window"
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 90
- Top = 690
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 2
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "axdUserDoc.dox":0000
- Key = "EquaFlipButton"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "axdUserDoc.dox":015C
- Key = "WiperButton"
- EndProperty
- EndProperty
- End
- Begin VB.TextBox txtCode
- Height = 495
- Left = 180
- MultiLine = -1 'True
- TabIndex = 0
- Text = "axdUserDoc.dox":02BC
- Top = 1335
- Visible = 0 'False
- Width = 15255
- End
- End
- Attribute VB_Name = "axdUserDoc"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = True
- Option Explicit
-
- Public Sub ClearImmediateWindow()
- 'Slightly modified from MSDN source sample code
- Dim oWindow As VBIDE.Window
-
- Set oWindow = VBInstance.Windows("Immediate")
- If oWindow Is Nothing Then Exit Sub '
-
- If oWindow.Visible = True Then
- oWindow.SetFocus
- SendKeys ("^({Home})"), True
- SendKeys ("^(+({End}))"), True
- SendKeys ("{Del}"), True
- End If
-
- Set oWindow = Nothing
-
- End Sub
-
-
- Public Sub FlipText()
- Dim nLineCount As Integer
- Dim i As Integer
- Dim sLine As String
- Dim sLeftSide As String
- Dim sRightSide As String
- Dim sNewCode As String
- Dim nPos As Integer
-
- 'Get the text from the clipboard and establisg the number of lines
- txtCode = Clipboard.GetText
- nLineCount = SendMessage(txtCode.hwnd, EM_GETLINECOUNT, 0&, 0&)
-
- 'loop through each line
- For i = 1 To nLineCount
- 'add a CR if there's more than one line
- If i > 1 Then sNewCode = sNewCode + vbCr
-
- 'if there's an equal sign in the text line,
- 'chop up the string and switch sides
- '(otherwise we do not affect the line)
- sLine = GetTextLine(i)
- nPos = InStr(sLine, "=")
- If nPos > 0 Then
- sLeftSide = Trim$(Left$(sLine, nPos - 1))
- sRightSide = Trim$(Right$(sLine, Len(sLine) - (nPos)))
- sLine = sRightSide + " = " + sLeftSide
- End If
-
- 'concatenate the new line
- sNewCode = sNewCode + sLine
-
- Next
-
- 'place the modified code on the clipboard
- Clipboard.Clear
- Clipboard.SetText sNewCode, vbCFText
-
- End Sub
-
- Function GetTextLine(ByVal nLineNumber As Integer) As String
- Const vbBufferSize = 1024 'max line length is set to 1024 bytes
- Dim sLine As String * vbBufferSize
- Dim nReturn As Long
-
- ' Assign buffer size to first word of sLine
- Mid$(sLine, 1, 1) = Chr$(vbBufferSize And &HFF)
- Mid$(sLine, 2, 1) = Chr$(vbBufferSize \ &H100)
-
- 'Get the line of text
- nReturn = SendMessage(txtCode.hwnd, EM_GETLINE, nLineNumber - 1, ByVal sLine)
-
- If nReturn Then
- GetTextLine = Left$(sLine, nReturn)
- Else
- GetTextLine = ""
- End If
-
- End Function
-
-
- Private Sub UserDocument_Initialize()
- Toolbar1.Buttons(1).Image = 1
- Toolbar1.Buttons(1).Key = "EquaFlipButton"
-
- Toolbar1.Buttons(2).Image = 2
- Toolbar1.Buttons(2).Key = "WiperButton"
-
- End Sub
-
- Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "EquaFlipButton"
- FlipText
- Case "WiperButton"
- ClearImmediateWindow
- End Select
- End Sub
-
-